package lt.f2g.domain.security;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

/**
 * Class for checking user credentials
 * @author Linas Jakaitis
 */
@Entity
public class UserProfile implements Serializable {
    
    @Id
    @Column(name="USER_NAME")
    private String username;
    private String password;
    
    @ManyToMany
    @JoinTable(name="PROFILE_ROLE",
        joinColumns=@JoinColumn(name="PROFILE_ID", referencedColumnName="USER_NAME"),
        inverseJoinColumns=@JoinColumn(name="ROLE_ID", referencedColumnName="ROLE_NAME")
    )
    private List<UserRole> roles;
    
    public List<UserRole> getRoles() {
        return roles;
    }
    public void setRoles(List<UserRole> roles) {
        this.roles = roles;
    }
    public String getUsername() {
        return username;
    }
    public void setUsername(String userName) {
        this.username = userName;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    
}